<?php
namespace Modules\ShopApi\Http\Controllers\v1;
use Illuminate\Http\Request;
use Modules\ShopApi\Http\Requests\IDMustBePositiveIntRequest;
use Modules\ShopApi\Http\Requests\EditNickNameRequest;
use Modules\ShopApi\Http\Requests\PhoneRequest;
use Modules\ShopApi\Http\Requests\BindingPhoneRequest;
use Modules\ShopApi\Models\ShopUserInfo;
use Modules\ShopApi\Models\ShopCollect as ShopCollectModel;
use Modules\ShopApi\Models\ShopConfig as ShopConfigModel;
use Modules\ShopApi\Models\BaseApiModel;
class AuthController extends CommonController
{		
	/**	 
	 * @name  用户登录	
	 * @method  POST		
	 */
    public function login(Request $request)
    {
		return (new ShopUserInfo())->login($request->all());
    }	
	/**	 
	 * @name  我的信息
	 * @method  POST		 
	 */
    public function my(Request $request)
    {
		return (new ShopUserInfo())->my();
    }
	/**	 
	 * @name  获取验证码
	 * @method  POST	
	 * @param phone 手机号	 
	 */
    public function send_code(PhoneRequest $request)
    {
		return (new BaseApiModel())->send_code($request->all()['phone']);
    }
	/**	 
	 * @name  判断验证码是否正确
	 * @method  POST	
	 * @param phone 手机号	 
	 * @param code 验证码	 
	 */
    public function verdict_code(BindingPhoneRequest $request)
    {
		return (new ShopUserInfo())->verdict_code($request->all());
    }
	/**	 
	 * @name  绑定手机号	
	 * @method  PUT
	 * @param phone 手机号
	 * @param code 验证码
	 * @return  JSON		 
	 */
    public function binding_phone(BindingPhoneRequest $request)
    {
		return (new ShopUserInfo())->binding_phone($request->all());
    }
	/**	 
	 * @name  我的收藏 
	 * @method  GET	
	 * @param page 页码
	 */
    public function my_collect(Request $request)
    {
		return (new ShopCollectModel())->my_collect();
    }
	/**	 
	 * @name  我的收藏查看 
	 * @method  PUT	
	 * @param id 收藏id
	 */
    public function my_collect_look(IDMustBePositiveIntRequest $request)
    {
		return (new ShopCollectModel())->my_collect_look($request->get('id'));
    }
	/**	 
	 * @name  修改头像 
	 * @method  PUT	
	 * @param id 图片id
	 */
    public function edit_avatar(IDMustBePositiveIntRequest $request)
    {
		return (new ShopUserInfo())->edit_avatar($request->get('id'));
    }
	/**	 
	 * @name  修改昵称
	 * @method  PUT	
	 * @param nick_name 昵称
	 */
    public function edit_nick_name(EditNickNameRequest $request)
    {
		return (new ShopUserInfo())->edit_nick_name($request->get('nick_name'));
    }	
	/**	 
	 * @name  退出登录
	 * @method  DELETE	
	 */
    public function logout()
    {
		return (new ShopUserInfo())->logout();
    }	
	/**	 
	 * @name  刷新token
	 * @method  PUT		
	 */
    public function refresh()
    {
        return (new ShopUserInfo())->refresh();
    }
    /**	 
	 * @name  获取关于我们信息
	 * @method  GET		
	 */
    public function config_content()
    {
        return (new ShopConfigModel())->config_content();
    }
	/**	 
	 * @name  项目打赏
	 * @method  GET		
	 */
    public function reward()
    {
        return (new ShopConfigModel())->reward();
    }
	/**	 
	 * @name  获取商城配置信息
	 * @method  GET		
	 */
    public function config_info()
    {
        return (new ShopConfigModel())->config_info();
    }
}
